#!/bin/sh
# eotk (c) 2017 Alec Muffett
cd %PROJECT_DIR% || exit 1

%%IF %IS_SOFTMAP%
pidfiles=`echo %PROJECT_DIR%/%TOR_WORKER_PREFIX%*.d/tor.pid`
%%ELSE
pidfiles=%PROJECT_DIR%/tor.pid
%%ENDIF

for pidfile in $pidfiles; do
    test -s $pidfile && kill -TERM `cat $pidfile`
done

nginxconf=%PROJECT_DIR%/nginx.conf
pidfile=%PROJECT_DIR%/nginx.pid
test -s $pidfile && nginx -c $nginxconf -s stop

exit 0
